#include <Qt\qapplication.h>
#include <Qt\qdesktopwidget.h>
#include <Qt\qsplashscreen.h>
#include <Qt\qpixmap.h>
#include <Qt\qpoint.h>

#include "ResaHotelGUI.h"

using namespace std;

class Sleeper : public QThread
{
public:
        static void sleep(unsigned long secs) {
                QThread::sleep(secs);
        }
};

int main(int argc, char* argv[]){
	QApplication app(argc, argv);

	QPoint desktopCenter(QApplication::desktop()->availableGeometry().center());

	QPixmap pixmap("img/splash.png");

	QLabel splash(0, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
	splash.setPixmap(pixmap);
	splash.setAttribute(Qt::WA_TranslucentBackground);
	splash.move(desktopCenter - QPoint(pixmap.width() / 2, pixmap.height() / 2));
	splash.show();

	app.processEvents();

	Sleeper::sleep(2);

	ResaHotelGUI resaGUI;
	
	resaGUI.adjustSize();
	resaGUI.move(desktopCenter - QPoint(resaGUI.width() / 2, resaGUI.height() / 2));

	resaGUI.show();

	splash.close();

	return app.exec();
}